<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
    <title>Reference</title>
    <link rel="stylesheet" href="../../../luadoc.css" type="text/css" />
	<!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/-->
</head>

<body>
<div id="container">

<div id="product">
	<div id="product_logo"></div>
	<div id="product_name"><big><b></b></big></div>
	<div id="product_description"></div>
</div> <!-- id="product" -->

<div id="main">

<div id="navigation">


<h1>LuaDoc</h1>
<ul>
	
	<li><a href="../../../index.html">Index</a></li>
	
</ul>


<!-- Module list -->



<!-- File list -->

<h1>Files</h1>
<ul>

	<li>
		<a href="../../../files/Luamodo_Dev/Bots/TestBot.html">Luamodo_Dev/Bots/TestBot.lua</a>
	</li>

	<li><strong>Luamodo_Dev/Classes/Bot_Class.lua</strong></li>
	
	<li>
		<a href="../../../files/Luamodo_Dev/Classes/Connection_Class.html">Luamodo_Dev/Classes/Connection_Class.lua</a>
	</li>

	<li>
		<a href="../../../files/Luamodo_Dev/Classes/Extension_Class.html">Luamodo_Dev/Classes/Extension_Class.lua</a>
	</li>

	<li>
		<a href="../../../files/Luamodo_Dev/Extensions/Control.html">Luamodo_Dev/Extensions/Control.lua</a>
	</li>

	<li>
		<a href="../../../files/Luamodo_Dev/Extensions/Stats.html">Luamodo_Dev/Extensions/Stats.lua</a>
	</li>

	<li>
		<a href="../../../files/Luamodo_Dev/Utils/Bot_Utils.html">Luamodo_Dev/Utils/Bot_Utils.lua</a>
	</li>

	<li>
		<a href="../../../files/Luamodo_Dev/Utils/Misc_Utils.html">Luamodo_Dev/Utils/Misc_Utils.lua</a>
	</li>

	<li>
		<a href="../../../files/Luamodo_Dev/main.html">Luamodo_Dev/main.lua</a>
	</li>

</ul>






</div> <!-- id="navigation" -->

<div id="content">

<h1>File <code>Luamodo_Dev/Classes/Bot_Class.lua</code></h1>







<h2>Functions</h2>
<table class="function_list">

	<tr>
	<td class="name" nowrap><a href="#Bot:AddCTCP">Bot:AddCTCP</a>&nbsp;(cmd, func)</td>
	<td class="summary">Adds a CTCP response </td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Bot:AddCmd">Bot:AddCmd</a>&nbsp;(cmd, func)</td>
	<td class="summary">Adds a command to the bot </td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Bot:AddHook">Bot:AddHook</a>&nbsp;(event, name, func)</td>
	<td class="summary">Adds a hook for the specified event </td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Bot:Connect">Bot:Connect</a>&nbsp;(Server, Port, Channels, AuthCmd)</td>
	<td class="summary">Creates a connection to an IRC server.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Bot:DoCTCP">Bot:DoCTCP</a>&nbsp;(cmd, argtable)</td>
	<td class="summary">Fires a CTCP event.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Bot:DoCmd">Bot:DoCmd</a>&nbsp;(cmd, argtable)</td>
	<td class="summary">Fires a command.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Bot:DoHook">Bot:DoHook</a>&nbsp;(event, argtable)</td>
	<td class="summary">Fires a list of hooks for the specified event.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Bot:DoTimers">Bot:DoTimers</a>&nbsp;()</td>
	<td class="summary">Loops through each timer checking whether or not they should be executed.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Bot:LoadExtension">Bot:LoadExtension</a>&nbsp;(extension)</td>
	<td class="summary">Loads an extension into a bot.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Bot:New">Bot:New</a>&nbsp;(ID, posnames)</td>
	<td class="summary">Creates and returns a new Bot object.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Bot:Think">Bot:Think</a>&nbsp;()</td>
	<td class="summary">Performs the bots timers, then calls :Think() on each connection that belongs to the bot.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Bot:Timer">Bot:Timer</a>&nbsp;(name, delay, reps, func, args)</td>
	<td class="summary">Adds, modifies, removes, or gets info about a timer.</td>
	</tr>

</table>




<h2>Tables</h2>
<table class="table_list">

	<tr>
	<td class="name" nowrap><a href="#Bot">Bot</a></td>
	<td class="summary">Bot.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Bot_mt">Bot_mt</a></td>
	<td class="summary">Bot metatable.</td>
	</tr>

</table>



<br/>
<br/>




<h2><a name="functions"></a>Functions</h2>
<dl class="function">



<dt><a name="Bot:AddCTCP"></a><strong>Bot:AddCTCP</strong>&nbsp;(cmd, func)</dt>
<dd>
Adds a CTCP response


<h3>Parameters</h3>
<ul>
	
	<li>
	  cmd: The text to match to fire the response (case insensitive)
	</li>
	
	<li>
	  func: The function to call when the CTCP response is fired <br><i>Note</i>: Functions should have two parameters, Func and Args, Func is the TableFunc version of the function, and Args is the arguments passed to DoCTCP. returng true from the func will cause it to not fire the CTCP event hooks.
	</li>
	
</ul>




<h3>Usage:</h3>
NewBot:AddCTCP("VERSION", function(Func,Args) Args.Connection:CTCP(Args.Nick,"Luamodo V1 using ".. _VERSION ..", ".. socket._VERSION ..", and ".. lfs._VERSION end)



<h3>Return value:</h3>
A TableFunc of the function passed



</dd>




<dt><a name="Bot:AddCmd"></a><strong>Bot:AddCmd</strong>&nbsp;(cmd, func)</dt>
<dd>
Adds a command to the bot


<h3>Parameters</h3>
<ul>
	
	<li>
	  cmd: The text to match to fire the command (case insensitive)
	</li>
	
	<li>
	  func: The function to call when the command is fired <br><i>Note</i>: Functions should have two parameters, Func and Args, Func is the TableFunc version of the function, and Args is the arguments passed to DoCmd. returng true from the func will cause it to not fire the PRIVMSG event hooks.
	</li>
	
</ul>




<h3>Usage:</h3>
NewBot:AddCmd("!test", function(Func, Args) print("Test!") end)



<h3>Return value:</h3>
A TableFunc of the function passed



<h3>See also:</h3>
<ul>
	
	<li><a href="">
		TableFunc
	</a>
	
</ul>

</dd>




<dt><a name="Bot:AddHook"></a><strong>Bot:AddHook</strong>&nbsp;(event, name, func)</dt>
<dd>
Adds a hook for the specified event


<h3>Parameters</h3>
<ul>
	
	<li>
	  event: The event to hook onto
	</li>
	
	<li>
	  name: The unique name to use for the hook to prevent collisions/allow overwrites
	</li>
	
	<li>
	  func: The function to call when the hook is fired <br><i>Note</i>: Functions should have two parameters, Func and Args, Func is the TableFunc version of the function, and Args is the arguments passed to DoHook
	</li>
	
</ul>




<h3>Usage:</h3>
NewBot:AddHook("PRIVMSG", "TestHook", function(Func, Args) OutputTable(Args) end)



<h3>Return value:</h3>
A TableFunc of the function passed



<h3>See also:</h3>
<ul>
	
	<li><a href="">
		TableFunc
	</a>
	
</ul>

</dd>




<dt><a name="Bot:Connect"></a><strong>Bot:Connect</strong>&nbsp;(Server, Port, Channels, AuthCmd)</dt>
<dd>
Creates a connection to an IRC server. connection is stored in the Bot object under Connections, indexed as a tostring of the connection table


<h3>Parameters</h3>
<ul>
	
	<li>
	  Server: the IRC server to connect to
	</li>
	
	<li>
	  Port: the port to use when connection
	</li>
	
	<li>
	  Channels: [optional] A table of channels to join upon successful connection <br><i>Note</i>: format for the table is {{channel = "#channel1", password = ""}, {channel = "#channel2", password = "duckhunt"}} where the password key is optional
	</li>
	
	<li>
	  AuthCmd: [optional] The string to send to the server to authenticate the bot (such as "ns identify somepassword")
	</li>
	
</ul>




<h3>Usage:</h3>
NewConnection = NewBot:Connect("irc.testserver.org",6667,{{channel = "#channel1", password = ""}, {channel = "#channel2", password = "duckhunt"}}, "ns identify somepassword")



<h3>Return value:</h3>
The newly created connection object



</dd>




<dt><a name="Bot:DoCTCP"></a><strong>Bot:DoCTCP</strong>&nbsp;(cmd, argtable)</dt>
<dd>
Fires a CTCP event. <br> <i>Note</i>: You do not need to call this manually, it is taken care of automatically.


<h3>Parameters</h3>
<ul>
	
	<li>
	  cmd: The CTCP response to be fired
	</li>
	
	<li>
	  argtable: A table of arguments to pass to the function
	</li>
	
</ul>








</dd>




<dt><a name="Bot:DoCmd"></a><strong>Bot:DoCmd</strong>&nbsp;(cmd, argtable)</dt>
<dd>
Fires a command. <br> <i>Note</i>: You do not need to call this manually, it is taken care of automatically.


<h3>Parameters</h3>
<ul>
	
	<li>
	  cmd: The command to fire.
	</li>
	
	<li>
	  argtable: 
	</li>
	
</ul>








</dd>




<dt><a name="Bot:DoHook"></a><strong>Bot:DoHook</strong>&nbsp;(event, argtable)</dt>
<dd>
Fires a list of hooks for the specified event. <br> <i>Note</i>: You do not need to call this manually, it is taken care of automatically


<h3>Parameters</h3>
<ul>
	
	<li>
	  event: The event to fire hooks for
	</li>
	
	<li>
	  argtable: A table of arguments to pass to each function
	</li>
	
</ul>








</dd>




<dt><a name="Bot:DoTimers"></a><strong>Bot:DoTimers</strong>&nbsp;()</dt>
<dd>
Loops through each timer checking whether or not they should be executed. <br> <i>Note</i>: You do not need to call this manually, it is taken care of automatically









</dd>




<dt><a name="Bot:LoadExtension"></a><strong>Bot:LoadExtension</strong>&nbsp;(extension)</dt>
<dd>
Loads an extension into a bot. Adds the extensions list of hooks, commands, and CTCP responses to the bot. Then it registers the bot with the extension


<h3>Parameters</h3>
<ul>
	
	<li>
	  extension: the extension object to load
	</li>
	
</ul>




<h3>Usage:</h3>
NewBot:LoadExtension(somextension)





</dd>




<dt><a name="Bot:New"></a><strong>Bot:New</strong>&nbsp;(ID, posnames)</dt>
<dd>
Creates and returns a new Bot object. Inserts the bot in the Bots table indexed by ID


<h3>Parameters</h3>
<ul>
	
	<li>
	  ID: a string used for the bots index in various tables as well as it's display name for console output
	</li>
	
	<li>
	  posnames: a table of possible nicks for IRC connections to use
	</li>
	
</ul>




<h3>Usage:</h3>
NewBot = Bot:New("Display Name",{"DefaultNick","AltNick1","AltNick2"})



<h3>Return value:</h3>
the newly created bot



</dd>




<dt><a name="Bot:Think"></a><strong>Bot:Think</strong>&nbsp;()</dt>
<dd>
Performs the bots timers, then calls :Think() on each connection that belongs to the bot. <br> <i>Note</i>: You do not need to call this manually as the MainLoop function takes care of it.





<h3>Usage:</h3>
NewBot:Think()





</dd>




<dt><a name="Bot:Timer"></a><strong>Bot:Timer</strong>&nbsp;(name, delay, reps, func, args)</dt>
<dd>
Adds, modifies, removes, or gets info about a timer.


<h3>Parameters</h3>
<ul>
	
	<li>
	  name: the name of the timer
	</li>
	
	<li>
	  delay: how long to wait before running the timer, specify "off" to remove the timer
	</li>
	
	<li>
	  reps: how many times to run the timer (pass 0 for a never-ending timer)
	</li>
	
	<li>
	  func: the function to run
	</li>
	
	<li>
	  args: a table of arguments to pass to the function
	</li>
	
</ul>




<h3>Usage</h3>
<ul>
	
	<li>NewBot:Timer("test", 1, 1, print, {"a", "b"}) creates a timer that runs once after one second and prints the strings "a" and "b"
	
	<li>NewBot:Timer("test") gets information about the timer
	
	<li>NewBot:Timer("test",nil,0) sets the timer to run forever <br><i>Note</i>: pass nil/omit parameters that you dont want to change
	
	<li>NewBot:Timer("test", "off") removes the timer
	
</ul>



<h3>Return values:</h3>
<ol>
	
	<li>False if the name parameter is invalid.<br> A table representing the timer if requested, or false if said timer doesnt exist.<br> The table for the newly created/modifed timer otherwise
	
	<li>An error message if return value 1 is false
	
</ol>



</dd>


</dl>




<h2><a name="tables"></a>Tables</h2>
<dl class="table">

<dt><a name="Bot"></a><strong>Bot</strong></dt>
<dd>Bot. <br> <i>Note</i>: The fields listed below are only available to objects created via Bot:New unless otherwise specified <br>


<em>Fields</em>
<ul>
	
	<li>
	  Extensions: A list of loaded extensions
	</li>
	
	<li>
	  Timers: A list of timers
	</li>
	
	<li>
	  CmdList: A list of commands
	</li>
	
	<li>
	  CTCPList: A list of CTCP responses
	</li>
	
	<li>
	  HookList: A list of hooks
	</li>
	
	<li>
	  ID: Display name and index for various tables
	</li>
	
	<li>
	  Connections: A list of connections
	</li>
	
	<li>
	  Settings: A table of various settings
	</li>
	
	<li>
	  Settings.Names: A table of nicks for IRC connections to use
	</li>
	
</ul>


</dd>


<dt><a name="Bot_mt"></a><strong>Bot_mt</strong></dt>
<dd>Bot metatable. <br>


<em>Fields</em>
<ul>
	
	<li>
	  __index: Index
	</li>
	
	<li>
	  __type: Type
	</li>
	
</ul>


</dd>


</dl>




</div> <!-- id="content" -->

</div> <!-- id="main" -->

<div id="about">
	<p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p>
</div> <!-- id="about" -->

</div> <!-- id="container" -->	
</body>
</html>
